<?php

class System extends Controller
{
	/**
	 * 解析函数
	 *
	 */
	function __construct()
	{
		parent::__construct();

		$this->loadModel('System_model');
	}

	function showDate()
	{

		if($this->in_var['request_method'] == 'post')
		{
			if($this->in_var['request_method'] == 'post')
			{
				if($this->System_model->SaveSystem())
				{
					goto("index.php?c=system&d=showDate&Msg=".urlencode("信息修改成功"));
					//success('基本参数修改成功！','');
				}
				else
				{
					goto("index.php?c=system&d=showDate&Msg=".urlencode("更新失败，请检查"));
				}
			}
		}
		else
		{
			$this->tpl->display('base_set.html');    //指定模板
		}


	}


	function clear()
	{
		if($this->in_var['request_method'] == 'post')
		{
			if($this->system_model->clear())
			{
				success('缓存更新成功！','index.php?c=system&d=clear');
			}

		}

		$this->tpl->display('clear.html');    //指定模板
	}

	//顶部导航.
	function main()
	{
		$this->tpl->display('index.html');    //指定模板
	}
	function top()
	{
		$this->tpl->display('alt_toplogo.html');    //指定模板
	}

	function left()
	{
		$this->tpl->display('alt_menu.html');    //指定模板
	}


	function bottom()
	{
		$this->tpl->display('alt_bottomlogo.html');    //指定模板
	}

	function right()
	{
		//统计站内数据
		$category_num = $this->System_model->dataNum('category');
		$movie_num = $this->System_model->dataNum('movie');

		$serverinfo = PHP_OS.' / PHP v'.PHP_VERSION;
		$serverinfo .= @ini_get('safe_mode') ? ' Safe Mode' : NULL;
		$dbversion = $this->System_model->db->Execute("SELECT VERSION()");

		while(!$dbversion->EOF)
		{
			$list[] = $dbversion->fields;
			$dbversion->moveNext();
		}

		$dbversion = $list['0']['VERSION()'];

		$fileupload = @ini_get('file_uploads') ? ini_get('upload_max_filesize') : '<font color="red">'.$lang['no'].'</font>';
		$dbsize = 0;
		$tablepre = UC_DBTABLEPRE;
		$record_set = $tables = $this->System_model->db->Execute("SHOW TABLE STATUS");

		while(!$record_set->EOF)
		{
			//echo $record_set->fields[Name]."|".$record_set->fields[Rows].'|'.num_bitunit($record_set->fields[Data_length])."<br>";
			$all_data_length =  $all_data_length + $record_set->fields['Data_length'];
			$record_set->fields['Data_length'] = fotmat_bit($record_set->fields['Data_length']);
			$record_set->MoveNext();
		}

		$record_set->Close();

		$dbsize = fotmat_bit($all_data_length) ? fotmat_bit($all_data_length) : '未知';

		$magic_quote_gpc = get_magic_quotes_gpc() ? 'On' : 'Off';
		$allow_url_fopen = ini_get('allow_url_fopen') ? 'On' : 'Off';


		//站内数据
		$this->tpl->assign('CategoryNum', $category_num);
		$this->tpl->assign('MovieNum', $movie_num);

		$this->tpl->assign('serverinfo', $serverinfo);
		$this->tpl->assign('fileupload', $fileupload);
		$this->tpl->assign('dbsize', $dbsize);
		$this->tpl->assign('dbversion', $dbversion);
		$this->tpl->assign('magic_quote_gpc', $magic_quote_gpc);
		$this->tpl->assign('allow_url_fopen', $allow_url_fopen);
		$this->tpl->assign('PhpVersion', phpversion());
		$this->tpl->display('alt_intro.html');    //指定模板
	}




}

?>